<!--{include file='common/header.htm'}-->
<!--{include file='common/header_nav.htm'}-->
<div class="plogin mr_t1 wide">
  <form action="/user/login" method="post" id="formlogin">
    <label class="label inline_block mr_b1" for="email">电子邮件</label>
    <input class="inputwidth" type="text" name="email" id="email" value="" maxlength="60" />
    <span id="email_error" class="errorbox">{$error->password}</span>
    <br />
    <label class="label inline_block mr_b1" for="password">密码</label>
    <input class="inputwidth" type="password" name="password" id="password" value="" maxlength="20" />
    <span id="password_error" class="errorbox">{$error->password}</span>
    <br />
    <input type="button" id="login" name="login" value="提交" />
    <input type="reset" value="重置" />
  </form>
</div>
<script src="/static/javascript/maxlength.js"></script>
<!--{literal}-->
<script type="text/javascript">
	$(document).ready(function(){
		$("#email").bind("propertychange", function(){
			$(this).maxlength();
		}).keydown(function(event){
			if (event.keyCode==13) {
				$("#login").click();
			} else {
				$("#email_error").css("visibility","hidden").html("");
			}
		});

		$("#password").bind("propertychange", function(){
			$(this).maxlength();
		}).keydown(function(event) {
			if (event.keyCode==13) {
				$("#login").click();
			} else {
				$("#password_error").css("visibility","hidden").html("");
			}
		});
		$("#login").click(function () {
			hasError = false;
			var emailReg = /^([\w-\.]+@([\w-]+\.)+[\w-]{2,4})?$/
			var email = $("#email").val();
			if(email.length==0) {
				$("#email_error").css("visibility","visible").html("邮件地址不能为空");
				hasError = true;
			} else if (!emailReg.test(email)) {
				$("#email_error").css("visibility","visible").html("邮件地址格式不正确");
				hasError = true;
			}
			var passlen = $("#password").val().length;
			if (passlen==0) {
				$("#password_error").css("visibility","visible").html("密码不能为空");
				hasError = true;
			} else if (passlen < 6) {
				$("#password_error").css("visibility","visible").html("密码长度不足");
				hasError = true;
			}
			if (false == hasError) {
				$("#formlogin")[0].submit();
			}
		});
	});
</script>
<!--{/literal}-->
<!--{include file='common/footer.htm'}-->